<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>地址管理</title>
	<link rel="icon" href="${project_name}/image/logo.png" >
	<link rel="stylesheet" type="text/css" href="${project_name}/css/head.css" />
	<link rel="stylesheet" type="text/css" href="${project_name}/css/footer.css" />
	<link rel="stylesheet" type="text/css" href="${project_name}/css/suercenter.css" />
	<script type="text/javascript" src="${project_name}/js/address.js"></script>
</head>
<script type="text/javascript" src="${project_name}/js/jquery-1.8.3.js"></script>
<script>
	$(function () {
		$(".tr-line").find("#update").click(function () {
			let p = $("#cmbProvince").html();
			let c = $("#cmbCity").html();
			let a = $("#cmbArea").html();
			var id = $(this).parent().find("input").val()
			$.ajax({
				url: '${project_name}/addressInfo/addmyaddress?id='+id,
				type: 'post',    // 请求方式
				async: false,    // 默认true 异步请求 同步为false
				data: "",
				success: function (data) {
					var str=''
						str+='<input name="token_key_id" value="f8482678750b4eba89c440c1b7c8a0af" type="hidden">\n' +
								'\t\t\t\t<input name="form_submit" value="ok" type="hidden">\n' +
								'\t\t\t\t<div class="new_addr">\n' +
								'\t\t\t\t\t<div class="addr_item">\n' +
								'\t\t\t\t\t\t<span class="label_n"><span class="c_red">*</span>收货人：</span>\n' +
								'\t\t\t\t\t\t<input class="itxt" name="consignee" id="true_name" type="text" value="'+data.consignee+'">\n' +
								'\t\t\t\t\t\t<div class="addr_msg">\n' +
								'\t\t\t\t\t\t\t<span id="error_true_name"></span>\n' +
								'\t\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t<div class="addr_item">\n' +
								'\n' +
								'\t\t\t\t\t\t<span class="label_n"><span class="c_red">*</span>所在地区：</span>\n' +
								'\t\t\t\t\t\t<select class="city" name="province" id="cmbProvince"></select>\n' +
								'\t\t\t\t\t\t<select class="city" name="city" id="cmbCity"></select>\n' +
								'\t\t\t\t\t\t<select class="city" name="area" id="cmbArea"></select>\n' +
								'\t\t\t\t\t\t<div class="addr_msg">\n' +
								'\t\t\t\t\t\t\t<span id="error_statename"></span>\n' +
								'\t\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t<div class="addr_item">\n' +
								'\t\t\t\t\t\t<span class="label_n"><span class="c_red">*</span>详细地址：</span>\n' +
								'\t\t\t\t\t\t<input placeholder="详细地址" name="details" class="itxt itxtaddr" id="address" type="text" value="'+data.details+'">\n' +
								'\t\t\t\t\t\t<div class="addr_msg">\n' +
								'\t\t\t\t\t\t\t<span id="error_address"></span>\n' +
								'\t\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t<div class="addr_item">\n' +
								'\t\t\t\t\t\t<span class="label_n"><span class="c_red">*</span>手机号码：</span>\n' +
								'\t\t\t\t\t\t<input placeholder="手机号码" name="tel" class="itxt itxt_tel" id="tel_phone" type="text" value="'+data.tel+'">\n' +
								'\t\t\t\t\t\t<div class="addr_msg">\n' +
								'\t\t\t\t\t\t\t<span id="error_tel_phone"></span>\n' +
								'\t\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t<div>\n' +
								'\t\t\t\t\t\t<input hidden readonly name="userId" value="${param.id}">\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t\t<div class="addr_item btn_item">\n' +
								'\t\t\t\t\t\t<a href="javascript:$(\'#myaddress\').submit();" onclick="" id="addresssubmit" class="btn_addaddr">确定</a>\n' +
								'\t\t\t\t\t</div>\n' +
								'\t\t\t\t</div>'

					$('#myaddress').html(str)
					addressInit('cmbProvince', 'cmbCity', 'cmbArea',null,data.province,data.city,data.area);
				}
			})
		})

	})
</script>
<body>
<!--顶部公用-->
<jsp:include page="public_header.jsp"></jsp:include>
<div class="w1000 ClearFix margin_top20">
	<jsp:include page="public_left.jsp"></jsp:include>
	<!--左侧end-->
	<div class="ur_right">
		<!--uer_top-->
		<div class="ur_location">
			<a>我的开心买</a>
			<span>&gt;</span>
			<a class="a_cur">地址管理</a>
		</div>
		<!--uer_top-->
		<div class="o_o_part">
			<div class="part_h2">收货地址</div>
			<form action="${project_name}/addressInfo/insert" method="post" id="myaddress">
				<input name="token_key_id" value="f8482678750b4eba89c440c1b7c8a0af" type="hidden">
				<input name="form_submit" value="ok" type="hidden">
				<div class="new_addr">
					<div class="addr_item">
						<span class="label_n"><span class="c_red">*</span>收货人：</span>
						<input class="itxt" name="consignee" id="true_name" type="text" >
						<div class="addr_msg">
							<span id="error_true_name"></span>
						</div>
					</div>
					<div class="addr_item">

						<span class="label_n"><span class="c_red">*</span>所在地区：</span>
						<select hidden class="city" name="province" id="new_cmbProvince"></select>
						<select class="city" name="province" id="cmbProvince" ></select>
						<select class="city" name="city" id="cmbCity"></select>
						<select class="city" name="area" id="cmbArea"></select>
						<div class="addr_msg">
							<span id="error_statename"></span>
						</div>
					</div>
					<div class="addr_item">
						<span class="label_n"><span class="c_red">*</span>详细地址：</span>
						<input placeholder="详细地址" name="details" class="itxt itxtaddr" id="address" type="text">
						<div class="addr_msg">
							<span id="error_address"></span>
						</div>
					</div>
					<div class="addr_item">
						<span class="label_n"><span class="c_red">*</span>手机号码：</span>
						<input placeholder="手机号码" name="tel" class="itxt itxt_tel" id="tel_phone" type="text">
						<div class="addr_msg">
							<span id="error_tel_phone"></span>
						</div>
					</div>
					<div>
						<input hidden readonly name="userId" value="${param.id}">
					</div>
					<div class="addr_item btn_item">
						<a href="javascript:$('#myaddress').submit();" onclick="" id="addresssubmit" class="btn_addaddr">确定</a>
					</div>
				</div>
			</form>
		</div>
		<!--pathend-->
		<div class="addr_list">
			<div class="addr_l_h2">
				已保存收货地址（<span>0</span>）
			</div>
			<table class="order_table">
				<thead class="theads">
				<tr>
					<td style="padding-left: 40px;">收货人</td>
					<td>收货人地址</td>
					<td>手机</td>
					<td>操作</td>
				</tr>
				</thead>
				<tbody>
				<c:if test="${empty addressInfoList}">
					<tr class="tr-line">
						<td colspan="5">您还没有任务收货地址 </td>
					</tr>
				</c:if>
				<c:forEach items="${addressInfoList}" var="ail">
					<tr class="tr-line">
						<td>${ail.consignee} </td>
						<td>${ail.details} </td>
						<td>${ail.tel} </td>
						<td>
							<input hidden readonly value="${ail.id}">
							<a href="javascript:;" onclick="" id="update">修改</a>
							<a href="${project_name}/addressInfo/delete?id=${ail.id}&userId=${ail.userId}">删除</a>
						</td>
					</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
</div>
<!--底部公用-->
<div class="footer">
	<div class="footer_b w1200"><img src="${project_name}/image/foot_img1.jpg"/></div>
	<div class="footer_help w1200">
		<div class="footer1_l">
			<dl class="helpDl">
				<dt><h5>使用帮助</h5></dt>
				<dd><a href="">税费收取规则 </a></dd>
				<dd><a href="">新手指南 </a></dd>
				<dd><a href="">常见问题 </a></dd>
				<dd><a href="">用户协议 </a></dd>
			</dl>
			<dl class="helpDl">
				<dt><h5>会员服务</h5></dt>
				<dd><a href="">积分政策  </a></dd>
				<dd><a href="">会员权益  </a></dd>
				<dd><a href="">会员等级  </a></dd>
			</dl>
			<dl class="helpDl">
				<dt><h5>支付方式</h5></dt>
				<dd><a href="">积分支付  </a></dd>
				<dd><a href="">货到付款  </a></dd>
				<dd><a href="">在线支付  </a></dd>
				<dd><a href="">优惠券支付  </a></dd>
			</dl>
			<dl class="helpDl">
				<dt><h5>配送方式</h5></dt>
				<dd><a href="">包邮政策   </a></dd>
				<dd><a href="">费用说明   </a></dd>
				<dd><a href="">配送说明   </a></dd>
			</dl>
			<dl class="helpDl">
				<dt><h5>售后服务</h5></dt>
				<dd><a href="">电子发票   </a></dd>
				<dd><a href="">售后咨询   </a></dd>
				<dd><a href="">退货办理   </a></dd>
				<dd><a href="">退货政策   </a></dd>
			</dl>
		</div>
		<div class="footer1_r">
			<ul>
				<li>
					<h2>手机开心买</h2>
					<img src="${project_name}/image/footer_ewm_01.png"/>
					<p>下载移动客户端</p>
				</li>
				<li>
					<h2>开心买微信</h2>
					<img src="${project_name}/image/footer_ewm_02.png"/>
					<p>开心买官方微信</p>
				</li>
			</ul>
		</div>
	</div>
	<div class="footer_nav">
		<div class="w720">
			<ul>
				<li>
					<a href="">关于开心买 </a>
					<span class="line"></span>
				</li>
				<li>
					<a href="">投资者关系 </a>
					<span class="line"></span>
				</li>
				<li>
					<a href="">商家入驻  </a>
					<span class="line"></span>
				</li>
				<li>
					<a href="">联系我们 </a>
					<span class="line"></span>
				</li>
			</ul>
		</div>
	</div>
	<div class="footer_bottom">
		<div class="w1200">
			<p>
				<span class="font_arial">Copyright© 2006-2016 happigo. All Rights Reserved </span>
				免费服务热线: 400-705-1111 | 固话也可拨打: 800-705-1111
				<span class="font_arial">E-Mail: service@happigo.com</span><br>
				湘ICP备12000157号 信息网络传播视听节目许可证号：1810530
			</p>
			<p class="footer_b">
				<a href="http://www.itrust.org.cn/home/index/itrust_certifi/wm/2782875193.jsp">
					<img src="${project_name}/image/foot_img3.png"/>
				</a>
				<a href="https://search.szfw.org/cert/l/CX20150428007576007720">
					<img src="${project_name}/image/foot_img4.png"/>
				</a>
			</p>
		</div>
	</div>
</div>
<script type="text/javascript">
	addressInit('cmbProvince', 'cmbCity', 'cmbArea');
</script>
<!--底部end-->
</body>
</html>
